package com.ubi.core.framework.request;

import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;

public class RequestCachingInputStream extends ServletInputStream {

    private final ByteArrayInputStream byteArrayInputStream;

    public RequestCachingInputStream(byte[] bytes) {
        byteArrayInputStream = new ByteArrayInputStream(bytes);
    }

    @Override
    public int read() throws IOException {
        return byteArrayInputStream.read();
    }

    @Override
    public boolean isFinished() {
        return true;
    }

    @Override
    public boolean isReady() {
        return true;
    }

    @Override
    public void setReadListener(ReadListener readListener) {

    }
}